﻿
namespace PhotoAlbum.Web
{
    using System;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data.Objects.DataClasses;
    using System.ServiceModel.DomainServices;
    using System.ServiceModel.DomainServices.Server;

    [MetadataTypeAttribute(typeof(Album.AlbumMetadata))]
    public partial class Album
    {
        internal sealed class AlbumMetadata
        {

            // Metadata classes are not meant to be instantiated.
            private AlbumMetadata()
            {
            }

            public DateTime DateCreated { get; set; }

            public string Description { get; set; }

            public int Id { get; set; }

            [ExternalReference]
            public EntityCollection<Invitation> Invitations { get; set; }

            public EntityCollection<PhotoAlbumUser> InvitedUsers { get; set; }

            [ReadOnly(true)]
            [Include("UserName", "OwnerName")]
            public PhotoAlbumUser Owner { get; set; }

            [ReadOnly(true)]
            public Guid OwnerId { get; set; }

            [ExternalReference]
            public EntityCollection<Picture> Pictures { get; set; }

            public string Title { get; set; }

            public int ViewsCount { get; set; }

            [EnumDataType(typeof(AlbumVisibility))]
            [Range(0, 2)]
            public int VisibilityStore { get; set; }

            [EnumDataType(typeof(CommentsPolicy))]
            [Range(0, 1)]
            public int CommentsPolicyStore { get; set; }
        }
    }

    [MetadataTypeAttribute(typeof(Comment.CommentMetadata))]
    public partial class Comment
    {

        internal sealed class CommentMetadata
        {

            // Metadata classes are not meant to be instantiated.
            private CommentMetadata()
            {
            }

            [Include("UserName", "AuthorUsername")]
            public PhotoAlbumUser Author { get; set; }

            public Nullable<int> AuthorId { get; set; }

            public DateTime DateCreated { get; set; }

            public int Id { get; set; }

            public bool NeedsApproval { get; set; }

            public Picture Picture { get; set; }

            public int PictureId { get; set; }

            [Required]
            [StringLength(1024, MinimumLength = 3, ErrorMessage = "A comment must be between 3 and 1000 characters.")]
            public string Text { get; set; }
        }
    }

    [MetadataTypeAttribute(typeof(FriendRequest.FriendRequestMetadata))]
    public partial class FriendRequest
    {
        internal sealed class FriendRequestMetadata
        {
            // Metadata classes are not meant to be instantiated.
            private FriendRequestMetadata()
            {
            }

            public DateTime DateCreated { get; set; }

            public int Id { get; set; }

            [Include("UserName", "InitiatorUsername")]
            public PhotoAlbumUser Initiator { get; set; }

            public int InitiatorId { get; set; }

            public PhotoAlbumUser Target { get; set; }

            [Required]
            public int TargetId { get; set; }
        }
    }

    [MetadataTypeAttribute(typeof(Invitation.InvitationMetadata))]
    public partial class Invitation
    {
        public Invitation()
        {
        }

        internal sealed class InvitationMetadata
        {

            // Metadata classes are not meant to be instantiated.
            private InvitationMetadata()
            {
            }

            public Album Album { get; set; }

            public int AlbumId { get; set; }

            public DateTime DateCreated { get; set; }

            public Guid Id { get; set; }

            public PhotoAlbumUser User { get; set; }

            public int UserId { get; set; }
        }
    }

    [MetadataTypeAttribute(typeof(PhotoAlbumUser.PhotoAlbumUserMetadata))]
    public partial class PhotoAlbumUser
    {
        internal sealed class PhotoAlbumUserMetadata
        {

            // Metadata classes are not meant to be instantiated.
            private PhotoAlbumUserMetadata()
            {
            }

            [Include("Count", "AlbumsCount")]
            public EntityCollection<Album> Albums { get; set; }

            [Exclude]
            public EntityCollection<Comment> Comments { get; set; }

            [Exclude]
            public EntityCollection<Picture> FavoritePictures { get; set; }

            [Exclude]
            public EntityCollection<FriendRequest> FriendRequests { get; set; }

            
            [Include("Count", "FriendsCount")]
            public EntityCollection<PhotoAlbumUser> Friends { get; set; }

            [Exclude]
            public EntityCollection<Invitation> Invitations { get; set; }

            [Exclude]
            public EntityCollection<Album> PrivateAlbums { get; set; }

            [Exclude]
            public EntityCollection<FriendRequest> SentFriendRequests { get; set; }

            public string UserName { get; set; }

            [Exclude]
            public EntityCollection<UserTag> UserTags { get; set; }
        }
    }

    [MetadataTypeAttribute(typeof(Picture.PictureMetadata))]
    public partial class Picture
    {
        internal sealed class PictureMetadata
        {
            // Metadata classes are not meant to be instantiated.
            private PictureMetadata()
            {
            }
            [ExternalReference]
            public Album Album { get; set; }

            [Required]
            public int AlbumId { get; set; }

            [Include("Count", "CommentsCount")]
            public EntityCollection<Comment> Comments { get; set; }

            public DateTime DateCreated { get; set; }

            public EntityCollection<PhotoAlbumUser> FavoriteForUsers { get; set; }

            public int Id { get; set; }

            [Exclude]
            public byte[] Image { get; set; }

            public EntityCollection<Tag> Tags { get; set; }

            [Exclude]
            public byte[] Thumbnail { get; set; }

            [Required]
            public string Title { get; set; }

            [ExternalReference]
            public EntityCollection<UserTag> UserTags { get; set; }
        }
    }

    [MetadataTypeAttribute(typeof(Tag.TagMetadata))]
    public partial class Tag
    {
        internal sealed class TagMetadata
        {
            // Metadata classes are not meant to be instantiated.
            private TagMetadata()
            {
            }

            [RegularExpression("#[0-9a-zA-Z]{6,6}")]
            public string Color { get; set; }

            public int Id { get; set; }

            [Include("Count", "PicturesCount")]
            public EntityCollection<Picture> Pictures { get; set; }

            [Required]
            [StringLength(16, MinimumLength = 2, ErrorMessage = "Tags must be between 2 and 16 characters long.")]
            public string Title { get; set; }
        }
    }

    [MetadataTypeAttribute(typeof(UserTag.UserTagMetadata))]
    public partial class UserTag
    {
        internal sealed class UserTagMetadata
        {

            // Metadata classes are not meant to be instantiated.
            private UserTagMetadata()
            {
            }

            public int Id { get; set; }

            [ExternalReference]
            public Picture Picture { get; set; }

            [Required]
            public int PictureId { get; set; }

            [Include("UserName", "UserName")]
            public PhotoAlbumUser User { get; set; }

            [Required]
            public int UserId { get; set; }

            public int AuthorId { get; set; }

            [Include("X", "X")]
            [Include("Y", "Y")]
            public Position Position { get; set; }

        }
    }
}
